package Thread;

public class ThreadDemo4 extends Thread{
    public static void main(String[] args) throws InterruptedException {
      ThreadDemo4 threadDemo4 = new ThreadDemo4();
      Thread.sleep(1000);
        System.out.println("main...");
      threadDemo4.setName("zcj");
      threadDemo4.start();
       new myThread("myThread").start();
    }

    @Override
    public void run() {
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(this.getName()+":heihei");
    }
}
class myThread extends Thread{
    public myThread(String name) {
        super(name);//直接把参数传入父类
    }

    @Override
    public void run() {
        System.out.println(this.getName()+"执行了。。。");
    }
}
